<template>
  <div class="myContainer">
    <!-- 头部标题 start -->  
    <el-row class="myHeadeTitle">
      <el-col :span="18" class="myLineHeight_35px">
        巡检计划管理
      </el-col>
      <el-col :span="6" class="myTextAlignRight">
        <el-button class="myBgGreen" @click="onAddValue">新增</el-button>
        <el-button class="myBgGreen">导出</el-button>
      </el-col>
    </el-row>
    <!-- 头部标题 end -->
    <!-- 搜索部分 start -->
    <el-row :gutter="10">
      <el-col :span="4">
        <template>
          <el-select v-model="housingEstateValue" placeholder="全部项目/小区">
            <el-option
              v-for="item in housingEstateOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </template>
      </el-col>
      <el-col :span="4">
        <el-cascader
          :options="cycleOptions"
          change-on-select
          placeholder="全部计划周期"
        ></el-cascader>
      </el-col>
      <el-col :span="4">
        <template>
          <el-select v-model="statusValue" placeholder="全计划状态">
            <el-option
              v-for="item in statusOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </template>
      </el-col>
      <el-col :span="4">
        <el-input placeholder="输入关键字进行查询" v-model="kw"></el-input>
      </el-col>
      <el-col :span="6">
        <el-button class="myBgGreen" @click="onSearchKW">查询</el-button>
      </el-col>
    </el-row>
    <!-- 搜索部分 end -->
    <!-- 数据列表 start -->
    <div class="myPaddingTop_10px">
      <template>
        <el-table
          :data="tableDataList"
          border
          @selection-change="handleSelectionChange"
          style="width: 100%">
          <el-table-column
            type="selection"
            width="100">
          </el-table-column>
          <el-table-column
            type="index"
            label="序号"
            width="100">
          </el-table-column>
          <el-table-column
            prop="housingEstate"
            label="所属小区">
          </el-table-column>
          <el-table-column
            prop="typeid"
            label="计划id">
          </el-table-column>
          <el-table-column
            prop="name"
            label="计划名称">
          </el-table-column>
          <el-table-column
            prop="status"
            label="当前状态">
          </el-table-column>
          <el-table-column
            prop="createtime"
            label="制定时间">
          </el-table-column>
          <el-table-column
            prop="cycle"
            label="计划周期">
          </el-table-column>
          <el-table-column
            label="操作">
            <template scope="scope">
              <el-button class="look" type="text" size="small" @click="getDetail(scope.row.id)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>
    <!--测试按钮-->
    <el-button class="look" type="text" size="small" @click="getDetail()">查看</el-button>
    

    <!-- 数据列表 end -->
    <!-- 分页控件 start -->
    <div class="block">                    
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page_num"
        :page-sizes="[10, 15]"
        :page-size="page_size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <!-- 分页控件 end -->
  </div>
</template>  

<style scoped>
  .myContainer{
    background: #fff;
    padding: 10px;
  }
  .myHeadeTitle{
    color: #000;
    font-weight: 500;
    font-size: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dbdbdb;
    margin-bottom:10px; 
  }
  .myHeadeTitle:before,.myHeadeTitle:after{
    content: " ";
    display: block;
    clear: both;
  }
  .myBgGreen{
    background: #00c2a9;
    border-color: #00c2a9;
    color: #fff;
    margin-top: 2px;
  }
  .myLineHeight_35px{
    line-height: 35px;
  }
  .myTextAlignRight{
    text-align: right;
  }
  .myBgGreen:hover{
    background: #33ceba;
  }
  .myPaddingTop_10px{
    padding-top: 10px;
  }  
  
</style>

<script>
  import { getHistoryList } from '@/api/maintenanceplan';

  export default {
     data(){
      return{
        kw:"",
        housingEstateValue:"",
        housingEstateOptions:[{value: '选项1',label: '小区1'}, {value: '选项2',label: '小区2'}],
        cycleValue:"",
        cycleOptions:[{
          value: 'jinnian',
          label: '今年',
          children: [
            {
              value: 'nian',
              label: '年',
            },
            {
              value: 'jidu',
              label: '季度',
            },
            {
              value: 'yue',
              label: '月',
            }
          ]
        },{
          value: 'mingnian',
          label: '明年',
          children: [
            {
              value: 'nian',
              label: '年',
            },
            {
              value: 'jidu',
              label: '季度',
            },
            {
              value: 'yue',
              label: '月',
            }
          ]
        }],
        tableDataList:[],
        page_num:1,
        page_size:10,
        total:null,
        statusValue:"",
        statusOptions:[]
      }
    },   
    components: {
        
    },
    mounted(){
      document.title = '巡检计划管理';
      
    },
    methods:{
      onSearchKW:function(){//关键词搜索

      },
      handleSelectionChange:function(val){//全选

      },
      getDetail:function(id){//查看详细
        this.$router.push({
          path:'/xjjhglxxrw',
          query: {type: 'info'}
        })
      },
      handleSizeChange(val) {//每页条数控制
        this.page_size = val;
      },
      handleCurrentChange(val) {//每页
        this.page_num = val;
      },
      onAddValue:function(){
        this.$router.push({
          path:'/xjjhglxx',
          query: {type: 'add'}
        })
      }
    }

  }

</script>  



